<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>违章记录列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/layui/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:100%;" id="dataFrm">
    <input id="id" name="id" type="hidden">
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">车牌号:</label>
        <div class="layui-input-block">
            <select id="carNo" name="car.id" class="carNo" lay-filter="carNo">
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">违章项目:</label>
        <div class="layui-input-block">
            <select id="pecOptionText" name="pecOption.id" class="pecOptionText" lay-filter="pecOptionText">
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">违章时间:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input pecDate" name="pecDate" lay-verify="required" placeholder="请输入违章时间">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">违章罚款:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input fine" name="fine" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">违章扣分:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input points" name="points" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">驾驶员:</label>
        <div class="layui-input-block">
            <select id="driverName" name="driver.id" class="driverName" lay-filter="driverName">
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">违章地点:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input pecPlace" name="pecPlace" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">违章备注:</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input remarks" name="remarks" lay-verify="required">
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="savePeccancyRecord">保存</button>
            <button id="cancel" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="resources/layui/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;

            //时间插件绑定
            laydate.render({
                elem:".pecDate"
            });

        form.render('select');

        $("#cancel").click(function () {
            var index1=parent.layer.getFrameIndex(window.name)
            parent.layer.close(index1);
        });

        form.on("submit(savePeccancyRecord)",function (data) {
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            //实际使用时的提交数据
            var params=$("#dataFrm").serialize();
            console.log(params);
            // $.ajax({
            //     url:'peccancyRecords',
            //     type:'PUT',
            //     contentType:'application/json',
            //     date:params,
            //     datatype: 'json',
            //     success:function (data) {
            //         console.log(res.code);
            //         if(res.code==2003){
            //             top.layer.close(index);
            //             top.layer.msg(res.msg);
            //             var index1=parent.layer.getFrameIndex(window.name)
            //             parent.layer.close(index1);
            //             parent.location.reload();
            //         }else{
            //             layer.msg(res.msg);
            //         }
            //     }
            // })

            $.post("peccancyRecords.do",params,function (res) {
                console.log(res.code);
                if(res.code==2003){
                    top.layer.close(index);
                    top.layer.msg(res.msg);
                    var index1=parent.layer.getFrameIndex(window.name)
                    parent.layer.close(index1);
                    parent.location.reload();
                }else{
                    layer.msg(res.msg);
                }
            },"json");
            return false;
        });
    });
</script>
</body>
</html>